-
Notifications
You must be signed in to change notification settings - Fork 13.7k
Ensure stack when type checking and building MIR for large if expressions #74708
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @davidtwco (or someone else) soon. If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes. Please see the contribution instructions for more information. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, thanks!
@bors r+ |
📌 Commit f64e58c has been approved by |
Ensure stack when type checking and building MIR for large if expressions Fixes rust-lang#74564
Is is safe for rollups, perf wise? |
I'm not sure, I'd assume so? |
Docs are not that convincing 😅:
|
Failed in rollup: #74719 (comment) |
Hmm, the test passed locally on my machine. I wonder what makes the rollup to fail 🤔 |
@kanru I can reproduce the failure on my local, you should rebase. |
I can reproduce with stage 2. Investigating... |
@bors r+ |
📌 Commit 0e2ec8c has been approved by |
@bors rollup=never (in case there is a perf impact) |
☀️ Test successful - checks-actions, checks-azure |
In Fedora, when we built rustc with PGO on ppc64le, we started failing the test `issue-74564-if-expr-stack-overflow.rs`. This could also be reproduced on other arches by setting a smaller `RUST_MIN_STACK`, so it's probably just unlucky that ppc64le PGO created a large stack frame somewhere in this recursion path. Adding an `ensure_sufficient_stack` solves the stack overflow. Historically, that test and its fix were added in rust-lang#74708, which was also an `ensure_sufficient_stack` in this area of code at the time. However, the refactor in rust-lang#92573 basically left that to the general `MutVisitor`, and then rust-lang#142240 removed even that ensure call. It may be luck that our tier-1 tested targets did not regress the original issue across those refactors.
Fixes #74564